package com.xiaoq.shop.entity;

import com.xiaoq.MongoEntity;
import org.mongodb.morphia.annotations.Entity;
import org.mongodb.morphia.annotations.Indexed;

/**
 * @author xinpeng created on 16/9/13-下午4:53.
 */
@Entity(value = "user_coupon_collection", noClassnameStored = true) //采用Morphia作为mongo client时
public class UserCouponEntity extends MongoEntity {

    @Indexed
    private String userId;

    @Indexed
    private String shopId;

    private String shopOrderId;

    private Long couponTemplateCode; //优惠券模板编码

    private String couponInstanceCode; //优惠券实例编码CouponEntity 主键

    private int numberOfCoupons; //当前面额的优惠券个数,目前支持为1,即1种面额的优惠券,1个用户只能领用一张

    private int denomination; //面额

    private int minSpendingAmountForUse; //可以使用此优惠券的最低消费金额

    private int state;  //状态,-1未使用| 0,未使用 | 1,已使用 | 2,已过期

    private Long effectiveDate; //生效日期

    private Long expirationDate; //失效日期

    private Long getTime; //领券时间

    private Long consumedTime;  //消券时间

    private String shopName;  //小店名称

    private String shopLogo;  //小店Logo

    public enum StateEnum {
        LOCKED(-1), //锁定状态
        NOUSE(0),  //未使用
        BEUSEED(1), //已使用
        EXPIRED(2), //已过期
        DELETE(3); //已删除

        private int code;

        StateEnum(int code){
            this.code = code;
        }

        public int value(){
            return this.code;
        }
    }

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getShopId() {
		return shopId;
	}

	public void setShopId(String shopId) {
		this.shopId = shopId;
	}

	public String getShopOrderId() {
		return shopOrderId;
	}

	public void setShopOrderId(String shopOrderId) {
		this.shopOrderId = shopOrderId;
	}

	public Long getCouponTemplateCode() {
		return couponTemplateCode;
	}

	public void setCouponTemplateCode(Long couponTemplateCode) {
		this.couponTemplateCode = couponTemplateCode;
	}

	public String getCouponInstanceCode() {
		return couponInstanceCode;
	}

	public void setCouponInstanceCode(String couponInstanceCode) {
		this.couponInstanceCode = couponInstanceCode;
	}

	public int getNumberOfCoupons() {
		return numberOfCoupons;
	}

	public void setNumberOfCoupons(int numberOfCoupons) {
		this.numberOfCoupons = numberOfCoupons;
	}

	public int getDenomination() {
		return denomination;
	}

	public void setDenomination(int denomination) {
		this.denomination = denomination;
	}

	public int getMinSpendingAmountForUse() {
		return minSpendingAmountForUse;
	}

	public void setMinSpendingAmountForUse(int minSpendingAmountForUse) {
		this.minSpendingAmountForUse = minSpendingAmountForUse;
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public Long getEffectiveDate() {
		return effectiveDate;
	}

	public void setEffectiveDate(Long effectiveDate) {
		this.effectiveDate = effectiveDate;
	}

	public Long getExpirationDate() {
		return expirationDate;
	}

	public void setExpirationDate(Long expirationDate) {
		this.expirationDate = expirationDate;
	}

	public Long getGetTime() {
		return getTime;
	}

	public void setGetTime(Long getTime) {
		this.getTime = getTime;
	}

	public Long getConsumedTime() {
		return consumedTime;
	}

	public void setConsumedTime(Long consumedTime) {
		this.consumedTime = consumedTime;
	}

	public String getShopName() {
		return shopName;
	}

	public void setShopName(String shopName) {
		this.shopName = shopName;
	}

	public String getShopLogo() {
		return shopLogo;
	}

	public void setShopLogo(String shopLogo) {
		this.shopLogo = shopLogo;
	}

}
